//
// Created by Jona on 2023/9/6.
//

#ifndef GYRO_FLOW_PORT_KEYFRAME_H
#define GYRO_FLOW_PORT_KEYFRAME_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Define the KeyframeType enum
typedef enum {
    Fov,
    VideoRotation,
    ZoomingSpeed,
    ZoomingCenterX,
    ZoomingCenterY,
    BackgroundMargin,
    BackgroundFeather,
    LockHorizonAmount,
    LockHorizonRoll,
    LensCorrectionStrength,
    SmoothingParamTimeConstant,
    SmoothingParamTimeConstant2,
    SmoothingParamSmoothness,
    SmoothingParamPitch,
    SmoothingParamRoll,
    SmoothingParamYaw,
    VideoSpeed
} KeyframeType;

typedef enum {
    NoEasing,
    EaseIn,
    EaseOut,
    EaseInOut
} Easing;

typedef struct {
    double value;
    Easing easing;
} Keyframe;

// Define KeyframeManager struct
typedef struct KeyframeManager {
    // keyframes is a BTreeMap<KeyframeType, BTreeMap<i64, Keyframe>>
    // Since C doesn't have built-in data structures like Rust's BTreeMap, you may need to implement it manually.
    // You can use arrays or linked lists to achieve similar functionality.

    // gyro_offsets is a BTreeMap<i64, f64>
    // You can implement a similar structure using arrays or linked lists.

    // custom_provider is an optional function pointer. In C, you can use function pointers for this purpose.
    double (*custom_provider)(struct KeyframeManager* manager, KeyframeType type, double value);

    // timestamp_scale is an optional field
    double* timestamp_scale;
} KeyframeManager;

Keyframe Keyframe_init(double value, Easing easing);

const char* keyframe_color(KeyframeType kf);

const char* keyframe_text(KeyframeType kf);

KeyframeManager KeyframeManager_init();

Easing get_easing(Easing a, Easing b);

#endif //GYRO_FLOW_PORT_KEYFRAME_H
